package SMS.controller;

import SMS.model.Res;
import SMS.model.ResData;
import SMS.vo.ILoginAccount;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author 王天宇
 */
@Controller
@CrossOrigin
@RequestMapping("/user")
public class UserController {

    @PostMapping ("/login")
    @ResponseBody
    public Res login(@RequestBody ILoginAccount data){
        System.out.println(data);
        Object data1 = new ResData(200, "登陆成功", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwaG9uZSI6IjEzNzk5ODg3NzY2IiwiZXhwIjoxNjk5ODY1MDE5fQ.27Kf6065zRu7liphRl3ccFtNxiyzDXv3jVCRJLTwLBM");
        Res res = new Res(200,"success",data1);
        System.out.println(res);
        return res;
    }

    @GetMapping("/userinfo")
    @ResponseBody
    public Res getUserInfo(){
        Object data = new ResData(200, "success", "{\"name\":\"王天宇\",\"sex\":\"男\",\"age\":\"22\",\"phone\":\"13799887666\"}");
        Res res = new Res(200,"success",data);
        return res;
    }
}
